package boot

import (
	"fmt"
	eventConfig "yunj/app/event"
	yunjEventConfig "yunj/pkg/yunj/app/event"
	"yunj/pkg/yunj/core/event"
)

// 初始化事件配置（包含订阅）
func InitEvent() {
	// 事件订阅
	var err error
	for name, listeners := range yunjEventConfig.Subscribes {
		if err = event.Subscribe(name, listeners...); err != nil {
			panic(fmt.Sprintf("事件订阅异常！%v", err))
		}
	}
	for name, listeners := range eventConfig.Subscribes {
		if err = event.Subscribe(name, listeners...); err != nil {
			panic(fmt.Sprintf("事件订阅异常！%v", err))
		}
	}
}
